<?php include "conn.php";
$get_id= mysqli_real_escape_string($conn,$_GET['shop_id']);
$cats = $dishes = array();
$shop_res= "SELECT * FROM `biz_shop` where biz_shop.shop_id='$get_id'";
$shop_res = mysqli_query($conn,$shop_res);

$shopres = mysqli_fetch_assoc($shop_res);
$list_data = $shopres['list_data'];
$list_data=(unserialize($list_data));

$sql_cat  = "SELECT * FROM `biz_dish_cat` where biz_dish_cat.shop_id='$get_id'";
$res = mysqli_query($conn,$sql_cat);
while($row = mysqli_fetch_assoc($res)){
    $cats[  $row['dish_cat']  ] = $row;
}

$sql_dish = "SELECT * FROM `biz_dish` where biz_dish.shop_id='$get_id'";
$res = mysqli_query($conn,$sql_dish);
?>
<?php include "header.php";?>
<body>
<?php include "body_top.php";?>
      <div class="restaurant-content">
        <div class="tab">
        饭店名称:<?=$shopres['name']?>
        </div>
      	<div class="tab">
        订餐电话:
		<?
		if($shopres['call_number']==0)
		{?>
		<? $str=explode("/",$shopres['telphone']);
			for($i=0;$str[$i];$i++)
			{
		 ?>
			<a href="wtai://wp/mc;<?= $str[$i];?>"><?= $str[$i];?></a>
			<?="&nbsp;&nbsp;";}?>
			<? }
			else
			{
			echo "&nbsp;&nbsp;";
			?>
			<a href="wtai://wp/mc;400-0411-569">400-0411-569 转 <?=$shopres['call_number']?></a>
			<?= "&nbsp;&nbsp;";
		}
        ?></div>
        <div class="tab">
        派送时间: <?=$list_data['delivery_time']?> 
        </div>
        <div class="tab">
        派送范围: <?=$list_data['delivery_desc']?> 
        </div>
        <div class="tab">
        饭店地址: <?=$shopres['address']?> <a href="/waimai/map.php?shop_id=<?=$get_id;?>">查看地图</a>
        </div>
        <div class="food-list">
          <table>
<? 
while($row = mysqli_fetch_assoc($res)){
   $dishes[ $row['dish_cat'] ][] = $row;
}
foreach($dishes as $cat_id => $dishlist){	
?>
            <tr>
              <td class="name" style=" color:#900"><strong>
            <?=$cats[$cat_id]['cat_name'];?>
                </strong></td>
                 <td class="name">&nbsp;</td>
            </tr>
             <? foreach($dishlist as $dish){?>
            <tr> 
              <td class="name"><?=$dish['name']; ?></td>
              <td class="name" style="text-align:right"><?=$dish['price'];?>元</td>
            </tr>
            <? }}?>
          </table>
     
<?php include "footer.php";?>
